package com.yeyks;

import com.yeyks.app.controller.websocket.c2b.C2bGrabTheOrderWebSocket;
import com.yeyks.common.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.TimeZone;

/**
 * 服务入口
 *
 * @author Beacon
 * @version $Id: Application.java, v 0.1 2018年07月30日 16:44 Beacon Exp $
 */
@SpringBootApplication
public class YyksOpenAppServerApplication {
    private static Logger LOGGER = LoggerFactory.getLogger(YyksOpenAppServerApplication.class);

    public static void main(String[] args) {
        //时区设置，避免服务以后放到docker容器中有时差问题
        TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
        LOGGER.info("system time:[{}]", new Date().toString());
        LOGGER.info("timezone:[{}]", System.getProperty("user.timezone"));
        ConfigurableApplicationContext context = SpringApplication.run(YyksOpenAppServerApplication.class, args);
        C2bGrabTheOrderWebSocket.setApplicationContext(context);
        LOGGER.info(DateUtils.formatYMDHMSStr(LocalDateTime.now()) + ", 夜鱼快宿appServer运行成功");
    }
}
